import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class a {
    public static void main(String[] args) {
        ExecutorService executorService = Executors.newFixedThreadPool(10);
        executorService.execute(new b());
        executorService.execute(new b());
        executorService.execute(new b());
        executorService.execute(new b());
        executorService.execute(new b());
        executorService.shutdown();

        for (int i = 1; i < 10; i++) {
            System.out.println("主线程" + i);

            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

    }
}

class b implements Runnable {

    @Override
    public void run() {
        for (int i = 1; i < 10; i++) {
            System.out.println("多线程" + i);
            System.out.println("-----------------------");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

    }
}